/**
 * EditTakenProjectInfoForm class.
 */
package pits.form;

import java.util.ArrayList;
import java.util.List;

import javax.portlet.ActionRequest;

import pits.util.Errand;

public class EditTakenProjectForm {

	private int projectID;
	private int empID;
	private List<String> roleNames;
	private List<Integer> roleIDs;
	private String periodFrom;
	private String periodTo;
	private String description;

	public EditTakenProjectForm(String txtProjectID, int empID) {
		this.projectID = Integer.parseInt(txtProjectID);
		this.empID = empID;
	}

	public List<String> validate() {
		List<String> errorMess = new ArrayList<String>();

		// new pits.util.Logger().writeln(projectID + "\n" + empID + "\n" +
		// periodFrom + "\n" + periodTo);

		return errorMess;
	}

	public void setFields(ActionRequest request) {

		Errand errand = new Errand();

		List<Integer> roleIDs = new ArrayList<Integer>();
		List<String> roleNames = new ArrayList<String>();

		errand.parseNameID(request.getParameter("role").split(":"), roleIDs, roleNames);

		setRoleIDs(roleIDs);
		setRoleNames(roleNames);

		setPeriodFrom(errand.parseDate(request.getParameter("periodFrom")));
		setPeriodTo(errand.parseDate(request.getParameter("periodTo")));
		setDescription(request.getParameter("description"));

		// new pits.util.Logger().write("setFields: done");
	}

	/**
	 * @return the projectID
	 */
	public int getProjectID() {
		return projectID;
	}

	/**
	 * @param projectID
	 *            the projectID to set
	 */
	public void setProjectID(int projectID) {
		this.projectID = projectID;
	}

	/**
	 * @return the empID
	 */
	public int getEmpID() {
		return empID;
	}

	/**
	 * @param empID
	 *            the empID to set
	 */
	public void setEmpID(int empID) {
		this.empID = empID;
	}

	/**
	 * @return the roleNames
	 */
	public List<String> getRoleNames() {
		return roleNames;
	}

	/**
	 * @param roleNames
	 *            the roleNames to set
	 */
	public void setRoleNames(List<String> roleNames) {
		this.roleNames = roleNames;
	}

	/**
	 * @return the roleIDs
	 */
	public List<Integer> getRoleIDs() {
		return roleIDs;
	}

	/**
	 * @param roleIDs
	 *            the roleIDs to set
	 */
	public void setRoleIDs(List<Integer> roleIDs) {
		this.roleIDs = roleIDs;
	}

	/**
	 * @return the periodFrom
	 */
	public String getPeriodFrom() {
		return periodFrom;
	}

	/**
	 * @param periodFrom
	 *            the periodFrom to set
	 */
	public void setPeriodFrom(String periodFrom) {
		this.periodFrom = periodFrom;
	}

	/**
	 * @return the periodTo
	 */
	public String getPeriodTo() {
		return periodTo;
	}

	/**
	 * @param periodTo
	 *            the periodTo to set
	 */
	public void setPeriodTo(String periodTo) {
		this.periodTo = periodTo;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

}
